import React from 'react'
import format from 'lib/util/format'

export const imsiCols = [{
  title:'用户信息',
  key:'userName',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
          <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/imsicrashtrace/'+rowData.appVersionId+'/'+rowData.deviceId+'/'+encodeURIComponent(fmtVal)
      }>{fmtVal}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  sortable:true
},{
  title:'崩溃会话时间',
  key:'lastLoginTime',
  sortable:true,
  formatter:format.stampToTime
}]

// crashlog - TraceView
export const imsiColsNew = [{
  title:'用户信息',
  key:'userName',
  // sortable:true,
  render:function(fmtVal,rowData){
    return (
      <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/trace/crashlog/'+rowData.appVersionId+'/'+rowData.deviceId+'/'+encodeURIComponent(rowData.userIdentifier)+'/'+rowData.crashNameId
      }>{rowData.userIdentifier}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  // sortable:true
},{
  title:'崩溃会话时间',
  key:'timestamp',
  // sortable:true,
  formatter:format.stampToTime
}]

// imsi - UserListView
export const imsiColsNew2 = [{
  title:'用户信息',
  key:'userName',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/imsi/'+encodeURIComponent(rowData.userIdentifier)+'/'+rowData.deviceId
      }>{rowData.userIdentifier}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  sortable:true
},{
  title:'最近访问时间',
  key:'timestamp',
  sortable:true,
  formatter:format.stampToTime
}]

// imsi - RootView
export const colsForCrashlog = [{
  title:'用户信息',
  key:'userName',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/trace/crashlog/'+rowData.appVersionId+'/'+rowData.deviceId+'/'+encodeURIComponent(rowData.userIdentifier)
      }>{rowData.userIdentifier}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  sortable:true
},{
  title:'崩溃会话时间',
  key:'timestamp',
  sortable:true,
  formatter:format.stampToTime
}]

// imsi - RootView
export const colsForWebview = [{
  title:'用户信息',
  key:'userName',
  sortable:true,
  render:function(fmtVal,rowData){
    let webview_module = rowData.webview_module ? rowData.webview_module: 'jsError'
    return (
      <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/trace/webview/'+rowData.appVersionId+'/'+rowData.deviceId+'/'+encodeURIComponent(rowData.userIdentifier)+'/'+webview_module
      }>{rowData.userIdentifier}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  sortable:true
},{
  title:'web问题反馈时间',
  key:'timestamp',
  sortable:true,
  formatter:format.stampToTime
}]

// imsi - RootView
export const colsForANR = [{
  title:'用户信息',
  key:'userName',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <a href={
        BlueWare.pageUrlPrefix+'/app/'+BlueWare.appId+'/imsisearch'+'#/trace/anr/'+rowData.appVersionId+'/'+rowData.deviceId+'/'+encodeURIComponent(rowData.userIdentifier)
      }>{rowData.userIdentifier}</a>
    )
  }
},{
  title:'设备信息',
  key:'model',
  sortable:true,
  render:function(fmtVal,rowData){
    return (
      <span>{rowData.manufacturer+' '+fmtVal}</span>
    )
  }
},{
  title:'APP版本',
  key:'appVersion',
  sortable:true
},{
  title:'ANR发生时间',
  key:'timestamp',
  sortable:true,
  formatter:format.stampToTime
}]
